/**
 * eCommerce Application Sample for J2EE Training 
 * Implementation of ProductBean
 * @author Fabienne Boyer - Didier Donsez
 * may 2006
 */

package ecom.beans;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class ProductBean implements java.io.Serializable {

	private static final long serialVersionUID = -2962399588603124939L;
	@Id
	String reference;
	String category;
	String name;
	String brand;
	String description;
	double euroPrice;
	double stock;
	
	public ProductBean() {
	}
	
	public ProductBean(String reference, String category, String name, String brand,
			String description, double euroPrice, double stock) {
		super();
		this.reference = reference;
		this.category = category;
		this.name = name;
		this.description = description;
		this.euroPrice = euroPrice;
		this.stock = stock;
		this.brand = brand;
	}

	public String getReference() {
		return reference;
	}

	public void setReference(String reference) {
		this.reference= reference;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public double getEuroPrice() {
		return euroPrice;
	}

	public void setEuroPrice(double euroPrice) {
		if (euroPrice >= 0) {
			this.euroPrice = euroPrice;
		}
	}

	public double getStock() {
		return stock;
	}
	
	
	public void setStock(double stock) {
		if (stock >= 0) {
			this.stock = stock;
		}
	}

	public String getLargePicLink() {
		return reference+".jpg";
	}

	public String getSmallPicLink() {
		return reference+"_small.jpg";
	}
	
	public String toString() {
		return brand + " " + name;
	}

	public String getBrand() {
		return brand;
	}
	
}
